<?php
/*
 * @ https://EasyToYou.eu - IonCube v11 Decoder Online
 * @ PHP 7.2 & 7.3
 * @ Decoder version: 1.1.6
 * @ Release: 10/08/2022
 */

// Decoded file for php version 71.
namespace app\massage\model;

class Diy extends \app\BaseModel
{
    protected $name = "massage_action_diy";
    public function dataAdd($data)
    {
        $res = $this->insert($data);
        return $res;
    }
    public function dataUpdate($dis, $data)
    {
        $res = $this->where($dis)->update($data);
        return $res;
    }
    public function dataList($dis, $page)
    {
        $data = $this->where($dis)->order("status desc,id desc")->paginate($page)->toArray();
        return $data;
    }
    public function dataInfo($dis)
    {
        $data = $this->where($dis)->find();
        if(empty($data)) {
            $input = $dis;
            $input["page"] = ["1" => [], "2" => [], "4" => [], "5" => []];
            $input["page"] = json_encode($input["page"]);
            $input["tabbar"] = [["id" => 1, "name" => "首页", "default_img" => "iconshouye11", "selected_img" => "iconshouye21"], ["id" => 2, "name" => "技师", "default_img" => "iconanmo1", "selected_img" => "iconanmo2"], ["id" => 4, "name" => "订单", "default_img" => "icondingdan3", "selected_img" => "icondingdan2"], ["id" => 5, "name" => "我的", "default_img" => "iconwode1", "selected_img" => "iconwode2"]];
            $input["tabbar"] = json_encode($input["tabbar"]);
            $this->dataAdd($input);
            $data = $this->where($dis)->find();
        }
        return !empty($data) ? $data->toArray() : [];
    }
    public function updateOne($id)
    {
        $user_id = $this->where(["id" => $id])->value("user_id");
        $res = $this->where(["user_id" => $user_id])->where("id", "<>", $id)->update(["status" => 0]);
        return $res;
    }
}

?>